package com.wn.web;

import com.github.pagehelper.PageInfo;
import com.wn.common.pojo.Hotel;
import com.wn.common.pojo.HotelHouse;
import com.wn.common.pojo.PageParam;
import com.wn.common.pojo.Rsp;
import com.wn.service.HotelHouseService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.rsocket.context.LocalRSocketServerPort;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

@RestControllerAdvice
@RequestMapping("hotelhouse")
@Api(value = "酒店房间接口",description = "酒店房间接口")
public class HotelHouseController {
    @Autowired
    private HotelHouseService hotelHouseService;

    /**
     * 查询所有
     * @param
     * @param
     * @return
     */
    @PostMapping("queryAll")
    public Rsp queryAll(@RequestBody PageParam<HotelHouse> hotelHousePageParam){

        Rsp rsp = hotelHouseService.queryAll(hotelHousePageParam);

        return rsp;
    }

    /**
     * 根据id查找房间信息
     * @param id
     * @return
     */
    @PostMapping("getHouseById")
    public Rsp getHouseById( Integer id){
        return hotelHouseService.getHouseById(id);
    }

    /**
     * 增加房间类别
     * @param hotelHouse
     * @return
     */
    @PostMapping("insertHouseType")
    public Rsp insertHouseType(@Valid HotelHouse hotelHouse){
        return hotelHouseService.insertHouseType(hotelHouse);
    }

    /**
     * 物理删除房间数据
     * @param id
     * @return
     */
    @PostMapping("deleteByPrimaryKey")
    public Rsp deleteByPrimaryKey(Integer id){
        return hotelHouseService.deleteByPrimaryKey(id);
    }
}
